Memory reliability has great impact on reliability of a computer system. Therefore, memory reliability needs to be improved. Currently, memory mirroring is generally used in the prior art to improve memory reliability.
An operating principle of a memory mirroring technology is as follows: Two memory areas are planned in hardware. One is used as primary memory, and the other is used as mirrored memory. When running, an operating system makes two copies of data in memory, which are respectively stored in the primary memory and the mirrored memory. Therefore, for the data in the memory, there are two sets of complete backup data. Complete memory mirroring requires that there are copies for all data in memory. When a server system runs normally, an original is used. When a host of one copy fails, the other copy is used instead. In this way, a data loss caused by a memory channel fault is avoided effectively, and server reliability is improved greatly. However, double physical memory is needed for implementing this function, and actual capacity utilization is only 50%. Due to very high costs, actually, few products use complete memory mirroring.
In the prior art, a partial memory mirroring technology emerges. The technology may use a part of memory in a computer system (for example, an area of a segment or several segments of memory addresses) as mirrored memory. However, in the prior art, the mirrored memory resides only at a hardware layer, and the operating system is not aware of the hardware layer. When the mirrored memory in the hardware layer changes, the mirrored memory cannot be accurately found in the operating system, and consequently, data cannot be accurately stored in the mirrored memory. In addition, a size of the mirrored memory is limited. When allocating the mirrored memory to data, the computer system allocates the mirrored memory only to data that is first generated. After the mirrored memory is fully occupied, no mirrored memory can be allocated to other data that needs to be allocated mirrored memory.